package com.chengzzz.czsee.core

import android.view.View
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*


open class BaseAcitivity : AppCompatActivity() {

    fun showloading(){
        this@BaseAcitivity.runOnUiThread(Runnable {
            // refresh ui 的操作代码
            progressBar1.bringToFront()
            progressBar1.visibility = View.VISIBLE
            getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
                WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
        })

    }

    fun hiddenloading(){
        progressBar1.bringToFront()

        this@BaseAcitivity.runOnUiThread(Runnable {
            // refresh ui 的操作代码
            if(progressBar1 != null && progressBar1.isShown()) {
                progressBar1.visibility = View.GONE
                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
            }

        })
}
}